package com.hama.zea.xml;

import java.io.File;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import javax.servlet.http.HttpServletRequest;

import org.dom4j.Attribute;
import org.dom4j.Document;
import org.dom4j.Element;
import org.dom4j.Node;
import org.dom4j.io.SAXReader;

public class XMLUtil {

	/*
	 * public static void main(String[] args) throws Exception { SAXReader
	 * reader = new SAXReader(); File file = new File("J:\\getim\\books2.xml");
	 * Document document = reader.read(file); Element root =
	 * document.getRootElement();//根节点
	 * //System.out.println("根节点:"+root.getName()); //获取节点下的所有子节点集合
	 * List<Element> classs=root.elements(); for (Element element : classs) {
	 * //System.out.println(element.getName()); List<Element>
	 * s=element.elements(); for (Element element2 : s) { List<Element>
	 * d=element2.elements(); for (Element element3 : d) {
	 * System.out.println(element3.getParent().attributeValue("name"));
	 * System.out.println(element3.attributeValue("name")); } } } //通过id找节点
	 * //Node node=
	 * 
	 * }
	 */
	public static void main(String[] args) {
		String str = "assskkddnjjdns56=xxxx57=aaa.xxx";
		Pattern pattern = Pattern.compile("56=(.*)57=");
		Matcher matcher = pattern.matcher(str);
		while (matcher.find()) {
			String m=matcher.group(1);
			str=str.replace(m, "******");
		}
		System.out.println(str);
		
	}
}
